<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>InitPHP框架 PHP框架 - A PHP Framework - Email</title>
<link href="static/common.css" type="text/css" rel="stylesheet" />
<meta name="keywords" content="php框架，国产php框架, initphp框架，MVC，分层体系" />
<meta name="description" content="initphp框架是一款国产php框架。initphp框架主要基于MVC模式，具备代码清晰，操作简单，功能齐全，开发快速，高效安全等特点，是您选择php框架的首选。" />
</head>
<body>
<div class="header">
  <div class="header_nav">InitPHP (A PHP Framework) 用户手册</div>
  <div class="header_div">
    <div class="header_title">第6章 6.7.5 Email</div>
    <div class="header_right"><a href="6_7_4.htm">上一页</a> <a href="6_7_6.htm">下一页</a> </div>
  </div>
</div>

<div class="title">
  <h3>接口描述：</h3>
</div>
<p>发送邮件类。属于InitPHP框架扩展类，需要通过$this->getLibrary()方法获取</p>

<div class="title">
  <h3>使用方法：</h3>
</div>
<pre id="php" class="php">
$email = $this->getLibrary('email'); 
</pre>
<div class="nav"></div>
<div class="title">
  <h3>实例：</h3>
</div>
<pre id="php" class="php">
$smtpserver = "smtp.sina.com";//SMTP服务器 
$smtpserverport =25;//SMTP服务器端口 
$smtpusermail = "xxxx@sina.com";//SMTP服务器的用户邮箱 
$smtpemailto = "xxxx@qq.com";//发送给谁 
$smtpuser = "xxxx@sina.com";//SMTP服务器的用户帐号 
$smtppass = "xxxx";//SMTP服务器的用户密码 
$mailsubject = "contact us";//邮件主题 
$mailbody = "<H1> hello initphp框架</H1>";//邮件内容 
$mailtype = "HTML";//邮件格式（HTML/TXT）,TXT为文本邮件 
$smtp = $this->getLibrary('email');//加载email类 
$smtp->config($smtpserver,$smtpserverport,true,$smtpuser,$smtppass); 
$smtp->debug = FALSE;//是否显示发送的调试信息 
$smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype); //发送邮件</pre>

<div class="footer">版权所有：<a href="">http://initphp.com</a> InitPHP (A PHP Framework) By @Aliyun_zhuli</div>
<script src="static/jquery.js" type="text/javascript"></script>
<link href="static/prettify/prettify.css" rel="stylesheet" type="text/css">
<script src="static/prettify/prettify.js" type="text/javascript"></script>
<script type="text/javascript" src="static/comm.js"></script>
</body>
</html>
